Repository navigation
feat(code): 请求分发与压缩按本次 effective-cfg 动态解析 - #8
Merged
Merged
Conversation
对齐 agent 域 prepare-request 钩子语义(#7),code 域的分发与压缩不再 在 run 启动时按初始 provider 固化配置: - code/modes/flow.scm:run-agent-loop-with-timeout 中普通 Provider 与 all-in-one 的分发改为每次请求按本次 effective-cfg 的 provider 动态 判断。运行中在普通模型与 all-in-one 之间切换时,后续请求分别进入 正确适配器;all-in-one 的 emit 注入与探活参数保持不变。 - code/core/compaction/flow.scm:compactor 执行时解析最新 effective-cfg, 压缩窗口、摘要请求模型与认证不再固定为创建闭包时的初始模型;未安装 prepare-request 时沿用创建时 cfg,非交互行为不变。 测试: - run-agent-loop-with-timeout-test 新增用例:工具执行期间经 prepare-request 把 model-id 从 A 切到 B,下一次请求收到 B。 - pi-make-compaction-option-test 新增用例:compactor 执行时调用 prepare-request 并按新窗口判定,未触发压缩时返回原消息列表。 全部通过 gf test agent/code/tui (120+585+513)、gf fmt --check、gf check。
对齐 agent loop README 的教程式标准(编号章节 + 语义讲解 + 函数索引): - modes/flow:新增模块在调用链中的位置(print/verbose/json 三种非交互 模式与 TUI Worker 复用)、run-session-flow 会话生命周期、 run-agent-loop-with-timeout 的请求分发流程图(普通 Provider 与 all-in-one 按本次 effective-cfg 动态判断)、自动压缩接入点与相关模块。 - compaction/flow:新增压缩在会话中的位置流程图、按本次 effective-cfg 解析的动机(窗口/摘要模型/认证三随切模一致)、all-in-one 压缩窗口 的链路状态取值表与相关模块。 两份索引同步标注本次 PR 引入的新语义。
- 新增 %resolve-session-timeout:收拢 CLI 参数优先、回落 cfg 的会话时长 解析逻辑,消除 prepare-system-prompt 与 run-agent-loop-with-timeout 中的重复内联 let。 - 新增 %make-request-dispatcher:把普通 Provider 与 all-in-one 的请求 分发闭包提为模块级工厂函数,携带原注释;run-agent-loop-with-timeout 主体收敛为“解析超时/轮数/会话时长 → 装配分发器 → 驱动主循环”。 行为不变;gf test code (585)、tui (513)、agent (120)、gf fmt、gf check 全部通过。
…ut 上方 内部子函数统一放在使用者上方,与 %resolve-session-timeout 等约定一致。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
承接 #7(agent 域
prepare-request钩子),完成/model立即生效改造(plan.md §4.1)中 code 域 的部分:请求分发与自动压缩不再在 run 启动时按初始 provider 固化,改为在每次执行时按本次 effective-cfg 动态解析。改动
code/liii/pi/code/modes/flow.scmrun-agent-loop-with-timeout中普通 Provider 与 all-in-one 的分发改为每次请求按本次 effective-cfg 的provider动态判断,而不是 run 启动时按初始 provider 固化。普通 A -> all-in-one -> 普通 B)时,后续请求分别进入正确适配器。probe-fn/request-fn测试注入口及 all-in-one 的 emit 注入。code/liii/pi/code/core/compaction/flow.scmpi-make-compaction-option创建的 compactor 执行时解析最新 effective-cfg:pi-resolve-compaction-window与pi-compact-session!使用同一份本次有效配置,切模后压缩阈值、摘要请求模型及认证一致。prepare-request时沿用创建时 cfg,非交互/CLI 行为不变;压缩条目格式不变。测试
run-agent-loop-with-timeout-test用例:工具执行期间经prepare-request把 model-id 从 A 切到 B,下一次请求收到的 config 是 B(普通供应商动态分发)。pi-make-compaction-option-test用例:compactor 执行时调用prepare-request并按切换后的新窗口判定,未触发压缩时返回原消息列表(eq?验证)。验证